<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script src="../lib/echarts.min.js"></script>
    <script src="../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
</head>

<body>
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<div id="main" style="width: 100%;height:400px;"></div>


<script>
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);


    $.ajax({
        "url":"http://localhost:8080/demo/prescription/getBar",
        "data":{},
        "success":function (result){
            option = {
                xAxis: {
                    type: 'category',
                    data: result.data[0]
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        data: result.data[1],
                        type: 'bar',
                        showBackground: true,
                        backgroundStyle: {
                            color: 'rgba(180, 180, 180, 0.2)'
                        }
                    }
                ]
            };


            myChart.setOption(option);
        },
        "dataType":"json"
    });



</script>
</body>

</html>